package com.genokon.uid.consumer.controller;

import com.genokon.uid.consumer.service.UidGeneratorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author by baichaoda
 * @date 2020/7/29 17:15
 */
@RestController
public class UidGeneratorController {
    @Resource
    private UidGeneratorService uidGeneratorService;

    @GetMapping("/getUid")
    public String getUid() {
        return String.valueOf( uidGeneratorService.getUid() );
    }

    @GetMapping("/parseUid/{uid}")
    public String parseUid(@PathVariable("uid") long uid) {
        return uidGeneratorService.parseUid(uid);
    }
}
